/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/25 10:55
  *
  * @file       pd_spi_io.c
  * @brief      SPI GPIO peripheral driver.
  *
  * @note       This file contains the peripheral driver for the SPI GPIO.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/25     Chris        the first version
  *
  ******************************************************************************
  */


#include "pd_spi_io.h"

static SPIGPIO *build(GPIO **ssel, uint8_t sselSize, GPIO *sclk, GPIO *mosi, GPIO *miso) {
    SPIGPIO *gpio = malloc(sizeof(SPIGPIO));

    Driver_add(gpio, GEN_PERM);

    gpio->ssel = ssel;
    gpio->sselSize = sselSize;
    gpio->sclk = sclk;
    gpio->mosi = mosi;
    gpio->miso = miso;

    return gpio;
}

const struct SPIGPIOClass SPIGPIOBuilder = {.build = &build};
